/*
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _DAL_SAMPLE_INFO_H_
#define _DAL_SAMPLE_INFO_H_

#include <stdint.h>
#include <stddef.h>
#include "base_type.h"
#include "dal/instance_handle.h"
#include "dal/write_params.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum dal_sample_state_kind
{
    DAL_READ_SAMPLE_STATE = 0x0001 << 0,
    DAL_NOT_READ_SAMPLE_STATE = 0x0001 << 1
} dal_sample_state_kind_e;

typedef enum dal_view_state_kind
{
    DAL_NEW_VIEW_STATE = 0x0001 << 0,
    DAL_NOT_NEW_VIEW_STATE = 0x0001 << 1
} dal_view_state_kind_e;

typedef enum dal_instance_state_kind
{
    DAL_ALIVE_INSTANCE_STATE = 0x0001 << 0,
    DAL_NOT_ALIVE_DISPOSED_INSTANCE_STATE = 0x0001 << 1,
    DAL_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE = 0x0001 << 2
} dal_instance_state_kind_e;

typedef struct dal_sample_info
{
    dal_sample_state_kind_e sample_state;
    dal_view_state_kind_e view_state;
    dal_instance_state_kind_e instance_state;
    dal_time_t source_timestamp;
    dal_instance_handle_t instance_handle;
    dal_instance_handle_t publication_handle;
    int32_t disposed_generation_count;
    int32_t no_writers_generation_count;
    int32_t sample_rank;
    int32_t generation_rank;
    int32_t absolute_generation_rank;
    BOOLEAN valid_data;

    // Compatible with FastDDS, only useful in FastDDS
    dal_sample_identity_t sample_identity;
    dal_sample_identity_t related_sample_identity;

} dal_sample_info_t;

typedef SEQUENCE(dal_sample_info_t) dal_sample_info_seq_t;

#ifdef __cplusplus
}
#endif

#endif  // _DAL_SAMPLE_INFO_H_